Phase 5: Code Review & Quality Gate (v1.3.3)#10
Merged
Conversation
Reviews every inherited module (22 findings, severity-triaged) and fixes all 15 actionable findings, then consolidates the quality gate. Fixes: - CR-01 auto-reconnect on serial connection loss (via hass.loop) - CR-02/WR-07 wrap blocking serial.Serial() opens in the executor - CR-03 use time.monotonic() for elapsed calibration timing - CR-04 log broad excepts (_LOGGER.exception) - CR-05 route legacy calibration save through cover._save_calibration() - T-05-04 fix sl-branch length guard (>= 8 -> >= 12) against truncated device_id - WR-01/02/04/08/09/11/13, IN-03 and related cleanups Tooling: - Install codespell + migrate config to pyproject.toml [tool.codespell] - Remove .pre-commit-config.yaml and the orphaned pre-commit dependency - Add CONTRIBUTING.md documenting the manual gate (pytest/ruff/mypy/codespell) - Add tests/test_quality_gate_tooling.py regression guards Gate green: 212 tests pass; ruff/mypy/codespell clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QwPMgtiypLgJ5nkR3mUGfL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 5: Code Review & Quality Gate (v1.3.3)
Goal: The inherited/forked source is reviewed, every actionable finding is fixed, and the manual pytest/ruff/mypy gate is the single documented quality path.
Status: Verified ✓ · Threat-secure ✓ · Nyquist-validated ✓
Every inherited module was reviewed and severity-triaged (22 findings), all 15 actionable findings were fixed with atomic commits, and the quality gate was consolidated: codespell config moved into
pyproject.toml, the unused.pre-commit-config.yamlremoved, and a contributor-facingCONTRIBUTING.mdnow documents the manual gate as the single quality path.Changes
Code review fixes
hass.loop, robust without a running loop)serial.Serial()opens in the executor (config flow + options flow)time.monotonic()for elapsed calibration timing_LOGGER.exceptioncover._save_calibration()(fixes calibration silently lost on reload)sl-branch length guard (>= 8→>= 12) so short frames can't yield a truncated device_idTooling / quality gate
pyproject.toml [tool.codespell].pre-commit-config.yamland the orphanedpre-commitlint dependencytests/test_quality_gate_tooling.pyregression guardsKey files:
custom_components/schellenberg_usb/{api,cover,config_flow,options_flow,options_flow_calibration,options_flow_pairing,options_flow_timed_calibration,__init__,const}.py,manifest.json,pyproject.toml,CONTRIBUTING.md,README.mdRequirements Addressed
.pre-commit-config.yamlremoved; manual gate documented as the single pathVerification
05-VERIFICATION.md)threats_open: 0(05-SECURITY.md)05-VALIDATION.md)Key Decisions
hass.loop.call_later()(notasyncio.get_running_loop()) so the synchronous transport callback works without a running loop.# noqa: BLE001+ justification (surface "unknown" to the user) rather than narrowed.